import Vue from 'vue';
import Router from 'vue-router';

Vue.use(Router);

export default new Router({
  routes: [
    {
      path: '/',
      redirect: '/index'
    },
    {
      path: '/login',
      component: resolve => require(['../views/Login.vue'], resolve)
    },
    {
      path: '/',
      component: resolve => require(['../components/Home.vue'], resolve),
      children: [
        {
          path: '/index',
          component: resolve => require(['../views/index/Index.vue'], resolve)
        },
        {
          path: '/user',
          component: resolve => require(['../views/user/User.vue'], resolve)
        },
        {
          path: '/sys/picManage',
          component: resolve => require(['../views/system/PicManage.vue'], resolve)
        },
        {
          path: '/sys/eacharts',
          component: resolve => require(['../views/system/Eacharts.vue'], resolve)
        },
        {
          path: '/user/msg',
          component: resolve => require(['../views/user/Message.vue'], resolve)
        },
        {
          path: '/user/upload',
          component: resolve => require(['../views/user/upload.vue'], resolve)
        },
        {
          path: '/500',
          component: resolve => require(['../views/500.vue'], resolve)
        },
        {
          path: '/404',
          component: resolve => require(['../views/404.vue'], resolve)
        }
      ]
    },
    {
      path: '*',
      redirect: '/404'
    }
  ]
});
